﻿using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;
using System.Data.SqlClient;
using System.Data;
using System.Runtime.InteropServices;
namespace BLL
{
    //定义服务协定
    [ServiceContract]
    public class LoginWindow
    {
        DAL.DALMethod myDAL = new DAL.DALMethod();

        /// <summary>
        /// 验证登录
        /// </summary>
        /// <param name="strAccount"></param>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        [OperationContract]//操作协定
        public DataSet CheckLogin(string strAccount, string strPassword)
        {
            //声明参数数组对象
            SqlParameter[] sqls =
            {
                //实例化数组对象
                new SqlParameter("@type",SqlDbType.NChar),
                new SqlParameter("@userName",SqlDbType.VarChar),
                new SqlParameter("@password",SqlDbType.VarChar),
            };
            //数组元素赋值
            sqls[0].Value = "LoginPassword";//存储语句名称
            sqls[1].Value = strAccount;//账号
            sqls[2].Value = strPassword;//密码
            //调用数据层查询方法
            DataSet ds = myDAL.QueryDataSet("LoginWindow", sqls);
            return ds;
        }
    }
}
